- Notifications
You must be signed in to change notification settings - Fork 5.8k
/
Copy path240. Search a 2D Matrix II_test.go
48 lines (38 loc) · 907 Bytes
/
240. Search a 2D Matrix II_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package leetcode
import (
"fmt"
"testing"
)
typequestion240struct {
para240
ans240
}
// para 是参数
// one 代表第一个参数
typepara240struct {
matrix [][]int
targetint
}
// ans 是答案
// one 代表第一个答案
typeans240struct {
onebool
}
funcTest_Problem240(t*testing.T) {
qs:= []question240{
{
para240{[][]int{{1, 4, 7, 11, 15}, {2, 5, 8, 12, 19}, {3, 6, 9, 16, 22}, {10, 13, 14, 17, 24}, {18, 21, 23, 26, 30}}, 5},
ans240{true},
},
{
para240{[][]int{{1, 4, 7, 11, 15}, {2, 5, 8, 12, 19}, {3, 6, 9, 16, 22}, {10, 13, 14, 17, 24}, {18, 21, 23, 26, 30}}, 20},
ans240{false},
},
}
fmt.Printf("------------------------Leetcode Problem 240------------------------\n")
for_, q:=rangeqs {
_, p:=q.ans240, q.para240
fmt.Printf("【input】:%v 【output】:%v\n", p, searchMatrix240(p.matrix, p.target))
}
fmt.Printf("\n\n\n")
}